<%--
  Created by IntelliJ IDEA.
  User: 86158
  Date: 2024/6/24
  Time: 23:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>商品详情</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }

        .product-details {
            width: 80%;
            margin: 20px auto;
            padding: 20px;
            border: 1px solid #ddd;
            border-radius: 8px;
        }

        .product-details h1 {
            text-align: center;
        }

        .product-details table {
            width: 100%;
            margin-top: 20px;
        }

        .product-details th, .product-details td {
            padding: 10px;
            border-bottom: 1px solid #ddd;
            text-align: left;
        }

        .product-details th {
            background-color: #f2f2f2;
        }

        .product-image img {
            max-width: 100%;
            height: auto;
        }

        .form-control {
            display: block;
            width: 100%;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        .btn {
            color: #fff;
            background-color: #337ab7;
            border-color: #2e6da4;
            padding: 10px 15px;
            font-size: 14px;
            border-radius: 4px;
            cursor: pointer;
        }

        .btn:hover {
            background-color: #286090;
            border-color: #204d74;
        }

        .form-m {
            width: 100%; /* 宽度设为100%，填满父元素 */
            padding: 8px 15px; /* 内边距 */
            margin: 4px 0; /* 外边距 */
            border: 1px solid #ccc; /* 边框 */
            border-radius: 4px; /* 圆角边框 */
            font-size: 16px; /* 字体大小 */
        }

        /* 可以添加一些聚焦时的样式变化 */
        .form-m:focus {
            border-color: #66afe9; /* 聚焦时边框颜色变化 */
            outline: none; /* 移除默认的聚焦轮廓 */
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6); /* 聚焦时的阴影效果 */
        }

        /* 可以添加一些禁用时的样式 */
        .form-m:disabled {
            background-color: #eee; /* 禁用时的背景色 */
            opacity: 0.65; /* 透明度降低 */
        }
    </style>
</head>
<body>
<div class="product-details">
    <h1>商品详情</h1>
    <form action="${pageContext.request.contextPath}/updateInventory?p_id=${product.productId}" method="post">
        <table>
            <tr>
                <th>商品名称</th>
                <td>${product.productName}</td>
            </tr>
            <tr>
                <th>商品价格</th>
                <td>
                    <input type="text" name="price" class="form-m" value="${product.price}" min="0">
                </td>
            </tr>

            <tr class="product-image">
                <th>商品图片</th>
                <td><img src="image/${product.imageUrl}" alt="商品图片"></td>
            </tr>
            <tr>
                <th>热门指数</th>
                <td>${product.popularityIndex}</td>
            </tr>
            <tr>
                <th>上架状态</th>
                <td>${product.status == 1 ? '上架' : '下架'}</td>
            </tr>
            <tr>
                <th>库存数量</th>
                <td>
                    <input type="number" name="inventory" class="form-control" value="${product.inventory}" min="0">
                </td>
            </tr>
            <tr>
                <th>商品描述</th>
                <td>${product.description}</td>
            </tr>
        </table>
        <button type="submit" class="btn">更新</button>
    </form>
</div>
</body>
</html>